import React from 'react';
import {connect} from 'react-redux';
import AsyncComponent from './commons/asyncComponent';
const Login = AsyncComponent(() => import(/* webpackChunkName: "Login" */ "./login/login"))
const Me = AsyncComponent(() => import(/* webpackChunkName: "Login" */ "./login/me"))
// import Loadable from 'react-loadable';

// let Login = Loadable(() => import(/* webpackChunkName: "Login" */ "./login/login"))


class Zhenliao extends React.Component{
  render(){
    return this.props.loginState?(
      <Me />
    ):(
      <Login />
    )
  }
}

let mapStateToProps = (state) => ({
  loginState:!!state.user.login
})

export default connect(mapStateToProps)(Zhenliao)
